from django.db import models

# Create your models here.


class ParkModel(models.Model):
    title = models.CharField(max_length=20)


class PriceModel(models.Model):
    park = models.ForeignKey(ParkModel, on_delete=models.CASCADE)
    level = models.CharField(max_length=5, choices=((0, '游客'), (1, '业主')))
    price = models.FloatField()


class UserModel(models.Model):
    name = models.CharField(max_length=20)
    title = models.CharField(max_length=20)
    level = models.CharField(max_length=5, choices=((0, '游客'), (1, '业主')), default=0, null=True, blank=True)
    number = models.IntegerField(default=0, null=True, blank=True)
    money = models.FloatField(default=0, null=True, blank=True)


class RecordModel(models.Model):
    park = models.ForeignKey(ParkModel, on_delete=models.CASCADE)
    user = models.ForeignKey(UserModel, on_delete=models.CASCADE)
    start = models.DateTimeField(auto_now_add=True)
    end = models.DateTimeField(auto_now=True)
    time = models.FloatField(null=True, blank=True)
    price = models.FloatField(null=True, blank=True)
    money = models.FloatField(null=True, blank=True)